﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Data;
using System.Data.SqlClient;
namespace ClassSystem
{
    public class DBHelperF
    {
        private string strCon = "Data Source=Z2Air;Initial Catalog=ClassDB;User ID=sa;Password=123456";
        public DataSet GetData(string sql)
        {
            DataSet ds = new DataSet();
            SqlConnection con = new SqlConnection(strCon);
            con.Open();
            SqlDataAdapter sda = new SqlDataAdapter(sql, con);
            sda.Fill(ds);
            con.Close();
            return ds;
        }

        public bool SetData(string sql)
        {
            bool result = false;
            SqlConnection con = new SqlConnection(strCon);
            con.Open();
            SqlCommand cmd = new SqlCommand(sql, con);
            result = cmd.ExecuteNonQuery() > 0;
            con.Close();
            return result;
        }
    }
}